<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>首页</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />

<!-- easyui -->
<script type="text/javascript" th:src="@{/easyui/jquery.min.js}" ></script>
<script type="text/javascript" th:src="@{/easyui/jquery.easyui.min.js}"></script>
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/default/easyui.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/icon.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/color.css}">
	<script type="text/javascript" th:src="@{/easyui/locale/easyui-lang-zh_CN.js}"></script>
</head>
<style>
	*{
		text-align: center;
	}
	textarea{
		text-align: left;
	}
	h2,#editForm{
		padding: 10px 20px;
	}
	#editForm>*{
		margin-top: 10px;
	}
	#editForm input{
		margin-left: 10px;
	}
</style>
<body>
	<h2>实验申请表</h2>
	<form id="editForm" method="post">
		编号：<input name="id" type="number" class="easyui-validatebox" data-options="required:true"/><br>
		<input name="apply_id" class="easyui-validatebox" data-options="required:true" th:value="${session.Id}" th:if="${not #strings.isEmpty(session.Id)}"/><br th:if="${not #strings.isEmpty(session.Id)}">
		项目名称：<input name="project_name" class="easyui-validatebox" data-options="required:true"/><br>
		<input name="college" class="easyui-validatebox" th:if="${not #strings.isEmpty(session.college)}" th:value="${session.college}"/><br th:if="${not #strings.isEmpty(session.college)}">
		项目类型:<input name="type" class="easyui-validatebox" /><br>
		项目描述:<textarea name="describe" class="easyui-validatebox" rows="3" cols="20"></textarea><br>
		<a id="saveBtn" href="#" class="easyui-linkbutton" >保存</a>
	</form>
	<script type="text/javascript" th:inline="none">
	$(function(){
		/*保存*/
		$("#saveBtn").click(function () {
			$("#editForm").form("submit",{
				url:"/project/saveProjectApply",     //提交表单
				onSubmit:function(){
					return $("#editForm").form("validate");
				},
				success:function(data){   //回传数据
					data=eval("("+data+")")
					if(data.success){
						$("#win").window("close");
						$("#list").datagrid("reload");
						$.messager.alert("提示","保存成功!","info");
					}else{
						$.messager.alert("提示","保存失败!",data.msg,"error");
					}
				}
			});
		})

	});
	</script>

</body>